# Use an official Node runtime as a parent image
FROM node:20-alpine

# Set working directory inside container
WORKDIR /usr/src/app

# Copy package.json and package-lock.json
COPY package*.json ./

# Install dependencies
RUN npm ci --only=production --verbose

# Copy your source code
COPY . .

# Expose the port the app runs on
EXPOSE 4000

# Define environment variable (optional)
# ENV NODE_ENV=production

# Run the application
CMD ["node", "index.js"]